<?php

namespace App\Http\Requests\airline\base;

use App\Http\ValidateResult;
use Illuminate\Support\Facades\Validator;

trait BanRequest
{
    public static function add_check(array $params): ValidateResult {
        $validator = Validator::make($params, [
            'name' => 'required|max:255',
            'length' => 'required|numeric',
            'width' => 'required|numeric',
            'height' => 'required|numeric',
            'volume' => 'required|numeric',
            'limit_weight' => 'required|numeric',
            'pivot' => 'required|numeric',
            'company_id' => 'required',
//            'ban_di' => 'required',
        ], [
            'name.required' => '请填写名称',
            'name.max' => '名称长度不能超过255个字符',
            'length.required' => '请填写长',
            'width.required' => '请填写宽',
            'height.required' => '请填写高',
            'volume.required' => '请填写可载体积',
            'limit_weight.required' => '请填写限重',
            'pivot.required' => '请填写pivot',
            'company_id.required' => '请选择航空公司',
//            'ban_di.required' => '请填写板底',
        ]);

        if ($validator->fails()) {
            return ValidateResult::error($validator->errors()->first());
        }
        return ValidateResult::correct();
    }

}
